package com.yanqu.road.server.manger.activity.recycle;

import com.yanqu.road.entity.activity.ActivityInfo;
import com.yanqu.road.entity.activity.ActivityItemRecycleData;
import com.yanqu.road.entity.enums.eActivityType;
import com.yanqu.road.server.logic.mail.MailManager;
import com.yanqu.road.server.manger.activity.carptrip.CarpTripMgr;

import java.util.ArrayList;
import java.util.List;

public class CarpTripActivityRecycleStrategy extends AbstractItemRecycleStrategy {

    @Override
    public void markNeedRecycleItem() {
        ActivityInfo activityInfo = CarpTripMgr.getActivityInfo();
        if(activityInfo != null){
            addRecycleItemData(activityInfo, CarpTripMgr.getConfig().getAddAuraItemId());
        }
    }

    private void addRecycleItemData(ActivityInfo activityInfo, int itemId) {
        List<String> paramList = new ArrayList<>();
        long recycleTime = activityInfo.getEndTime() * 1000L + 600 * 1000;
        paramList.add(String.valueOf(itemId));
        paramList.add(String.valueOf(CarpTripMgr.getConfig().getScoreItemId()));
        paramList.add("2");
        paramList.add(activityInfo.getActivityName());
        ActivityItemRecycleMgr.addRecycleItemData(itemId, activityType, 1, recycleTime, paramList);
    }

    @Override
    protected void initActivityType() {
        activityType = eActivityType.CarpTripActivity.getValue();
    }

    @Override
    protected void doRecycle(long userId, ActivityItemRecycleData data) {
        String titleKey = MailManager.ACTIVITY_GOODS_AUTO_CONSUME_TITLE;
        String contentKey = MailManager.ACTIVITY_GOODS_AUTO_CONSUME_CONTENT;
        item2Score(userId, data, titleKey, contentKey);

    }

    @Override
    public boolean isActivityRunning() {
        return false;
    }
}
